package com.nbsaas.boot.manufacturing.rest.resource;

import com.nbsaas.boot.manufacturing.api.apis.BillOfMaterialApi;
import com.nbsaas.boot.manufacturing.data.entity.BillOfMaterial;
import com.nbsaas.boot.manufacturing.api.domain.request.BillOfMaterialRequest;
import com.nbsaas.boot.manufacturing.api.domain.response.BillOfMaterialResponse;
import com.nbsaas.boot.manufacturing.api.domain.simple.BillOfMaterialSimple;
import com.nbsaas.boot.manufacturing.rest.convert.BillOfMaterialSimpleConvert;
import com.nbsaas.boot.manufacturing.rest.convert.BillOfMaterialEntityConvert;
import com.nbsaas.boot.manufacturing.rest.convert.BillOfMaterialResponseConvert;
import com.nbsaas.boot.manufacturing.data.repository.BillOfMaterialRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   物料清单-业务接口实现
*/
@Transactional
@Service
public class BillOfMaterialResource extends BaseResource<BillOfMaterial,BillOfMaterialResponse, BillOfMaterialSimple, BillOfMaterialRequest>  implements BillOfMaterialApi {

    @Resource
    private BillOfMaterialRepository billOfMaterialRepository;

    @Override
    public JpaRepositoryImplementation<BillOfMaterial, Serializable> getJpaRepository() {
        return billOfMaterialRepository;
    }

    @Override
    public Function<BillOfMaterial, BillOfMaterialSimple> getConvertSimple() {
        return new BillOfMaterialSimpleConvert();
    }

    @Override
    public Function<BillOfMaterialRequest, BillOfMaterial> getConvertForm() {
        return new BillOfMaterialEntityConvert();
    }

    @Override
    public Function<BillOfMaterial, BillOfMaterialResponse> getConvertResponse() {
        return new BillOfMaterialResponseConvert();
    }




}


